#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;

int n, m;
int a[N];
struct Bit {
  int n;
  vector<int> bit;
  void init(int _n) {
    n = _n;
    bit = vector<int>(n + 1, 0);
  }
  static int lowbit(int x) { return x & -x; }
  void add(int x, int d) {
    for (int i = x; i <= n; i += lowbit(i)) bit[i] += d;
  }
  int query(int x) {
    int res = 0;
    for (int i = x; i > 0; i -= lowbit(i)) res += bit[i];
    return res;
  }
} bl, br;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  rep(i, 1, n) cin >> a[i];
  bl.init(n), br.init(n);
  rep(i, 1, n) br.add(a[i], 1);
  ll ans1 = 0, ans2 = 0;
  rep(i, 1, n) {
    br.add(a[i], -1);
    ll x = i - 1 - bl.query(a[i]), y = n - i - br.query(a[i]);
    ans1 += x * y;
    x = i - 1 - x, y = n - i - y;
    ans2 += x * y;
    bl.add(a[i], 1);
  }
  cout << ans1 << ' ' << ans2;
  return 0;
}